package com.yunkaweilai.android.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.text.Html;
import android.view.View;
import android.widget.TextView;

import com.github.lazylibrary.util.StringUtils;
import com.yunkaweilai.android.R;


/**
 * Created by Administrator on 2016/12/22 0022.
 */

public class NoTimeDialogForLogin extends Dialog {
    private TextView idTvContent;
    private TextView idTvRight;
    private String msg;
    private String url;
    private Context context;

    public NoTimeDialogForLogin(@NonNull Context context, String msg, String url) {
        super(context, R.style.dialog);
        this.msg = msg;
        this.context = context;
        this.url = url;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_update_app_beiyong);
        idTvContent = ((TextView) findViewById(R.id.id_tv_content));
        idTvRight = ((TextView) findViewById(R.id.id_tv_right));
        idTvContent.setText(Html.fromHtml(msg));
        idTvRight.setText("确  定");
        idTvRight.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!StringUtils.isEmpty(url)) {
                    Uri url1 = Uri.parse(url);
                    Intent intent = new Intent(Intent.ACTION_VIEW, url1);
                    context.startActivity(intent);
                }
                dismiss();
            }
        });

    }

}
